<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TcaKnowledgefolder> list = (List<TcaKnowledgefolder>)request.getAttribute("list");
	WikiForm form = (WikiForm)request.getAttribute("command");
%>
<style>
	.win_catalog-p{
		padding:20px 0 0 30px; 
	}
	.win_catalog-p input{
		padding:3px 0 4px 2px;	
	}
</style>

<div class="wikiFolderPanel">
	<div class="hd">
		<a class="a-btn-microsoft" href="javascript:XF.WIKI.catalog_addSub('-1')">添加一级目录</a>
	</div>
	<div class="bd">
		<ul class="one">
	<%
		if(!CollectionUtils.isEmpty(list)){
			for(TcaKnowledgefolder f:list){
				//1.判断为一级类目
				if("0".equalsIgnoreCase(f.getLevelid()+"")){
					String title = f.getTitle();
					%>
					<li class="file">
						<div class="one">
							<i class="icon switch"></i>
							<i class="icon folder"></i>
							<a class="txt" sid="<%=EncrypTool.encode(f.getFolderid())%>" href="javascript:XF.WIKI.view(<%=f.getFolderid()%>)"><%=title%></a>
							<div class="btn">
								<a class="link" href="javascript:XF.WIKI.catalog_edit(<%=f.getFolderid()%>)">修改</a>
								<a class="link" href="javascript:XF.WIKI.catalog_addSub(<%=f.getFolderid()%>)">添加子目录</a>
							</div>
						</div>
						<%if(!CollectionUtils.isEmpty(f.getSubFloders())){%>
						<!-- 二级目录 -->
							<ul class="two">
								<%for(TcaKnowledgefolder sub2F:f.getSubFloders()){%>
									<li class="file">
										<div class="two">
											<i class="icon switch"></i>
											<i class="icon folder"></i>
											<a class="txt" sid="<%=EncrypTool.encode(sub2F.getFolderid())%>" href="javascript:XF.WIKI.view(<%=sub2F.getFolderid()%>)"><%=sub2F.getTitle()%></a>
											<div class="btn">
												<a class="link" href="javascript:XF.WIKI.catalog_edit(<%=sub2F.getFolderid()%>)">修改</a>
												<a class="link" href="javascript:XF.WIKI.catalog_addSub(<%=sub2F.getFolderid()%>)">添加子目录</a>
											</div>
										</div>
										<%if(!CollectionUtils.isEmpty(sub2F.getSubFloders())){%>
										<!-- 三级目录 -->
										<ul class="three">
											<%for(TcaKnowledgefolder sub3F:sub2F.getSubFloders()){%>
												<li class="file">
													<div class="three">
														<i class="icon switch"></i>
														<i class="icon folder"></i>
														<a class="txt" sid="<%=EncrypTool.encode(sub3F.getFolderid())%>" href="javascript:XF.WIKI.view(<%=sub3F.getFolderid()%>)"><%=sub3F.getTitle()%></a>
														<div class="btn">
															<a class="link" href="javascript:XF.WIKI.catalog_edit(<%=sub3F.getFolderid()%>)">修改</a>
														</div>
													</div>
												</li>
											<%}%>
										</ul>
										<!-- 三级目录 END -->
										<%}%>
									</li>
								<%}%>
							</ul>
							<!-- 二级目录 END -->
						<%}%>
					</li>
					<%
				}
			}
		}
	%>
		</ul>
	</div>
</div>

<div id="win_catalog" closed="true" class="easyui-window" title="修改目标标题" style="width:300px;height:180px;" sid="" stitle="">  
    <form style="padding:10px 20px 10px 40px;">  
        <p class="win_catalog-p">新标题： <input type="text" name="newTitle"></p> 
        <div style="padding:5px;text-align:center;">  
            <a href="javascript:XF.WIKI.catalog_doEdit()" class="easyui-linkbutton" icon="icon-ok">确认</a>  
        </div>  
    </form>  
</div> 
<div id="win_catalog_add" closed="true" class="easyui-window" title="增加目录" style="width:300px;height:180px;" sid="" stitle="">  
    <form style="padding:10px 20px 10px 40px;">  
        <p class="win_catalog-p">标题： <input type="text" name="newTitle_add"></p> 
        <div style="padding:5px;text-align:center;">  
            <a href="javascript:XF.WIKI.catalog_doAddSub()" class="easyui-linkbutton" icon="icon-ok">确认</a>  
        </div>  
    </form>  
</div>
<script>
	$("#win_catalog").window();
	$("#win_catalog_add").window();
</script>

